home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8985 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.5 KB  |  79 lines

  1. Path: dialupline64.ghgcorp.com!user
  2. From: gastineau@ghgcorp.com (Brian Gastineau)
  3. Newsgroups: comp.lang.c++
  4. Subject: templates on VAX/VMS
  5. Date: Sun, 25 Feb 1996 16:24:01 -0500
  6. Organization: GHG Corporation
  7. Message-ID: <gastineau-2502961624010001@dialupline64.ghgcorp.com>
  8. NNTP-Posting-Host: 206.29.116.222
  9.  
  10. I am trying to implement a linked list template out of the "C++ How to
  11. Program" textbook by Deitel & Deitel, 1994, page 697, on a VAX.
  12.  
  13. The node template class is of the form:
  14.  
  15.    template<class NODETYPE>
  16.    class ListNode {
  17.       friend class List<NODETYPE>;
  18.    public:
  19.       ListNode(const NODETYPE &);
  20.       NODETYPE getData() const;
  21.    private:
  22.       NODETYPE data;
  23.       ListNode *nextPtr;
  24.    };
  25.  
  26. The list template class is of the form:
  27.  
  28.    template<class NODETYPE>
  29.    class List {
  30.    public:
  31.       List();
  32.       ~List();
  33.       void insertAtFront(const NODETYPE &);
  34.       void insertAtBack(const NODETYPE &);
  35.       int removeFromFront(NODETYPE &);
  36.       int removeFromBack(NODETYPE &);
  37.       int isEmpty() const;
  38.       void print() const;
  39.    private:
  40.      ListNode<NODETYPE> *firstPtr;
  41.        ListNode<NODETYPE> *lastPtr;
  42.       ListNode<NODETYPE> *getNewNode(const NODETYPE &);
  43.    };
  44.  
  45. All of the object function declaration have a related function body
  46. included in the same file.  I've got some subroutines in other files that
  47. are compiling and linking OK, so I don't think that the problem lies with
  48. not including the files in the right way
  49.  
  50. The driver uses the templates in the following lines:
  51.  
  52.    List<int> integerList;
  53.    List<float> floatList;
  54.  
  55. The code compiles OK, but during linking, the following errors are given:
  56.  
  57.    $ link driver
  58.    %LINK-W-NUDFSYMS, 14 undefined symbols:
  59.    %LINK-I-UDFSYM,         INSERTATBACK__8LIST___FXNKF
  60.    %LINK-I-UDFSYM,         INSERTATBACK__8LIST___IXNKI
  61.    %LINK-I-UDFSYM,         INSERTATFRONT__8LIST___FXNKF
  62.    %LINK-I-UDFSYM,         INSERTATFRONT__8LIST___IXNKI
  63.    %LINK-I-UDFSYM,         PRINT__K8LIST___FXV
  64.    %LINK-I-UDFSYM,         PRINT__K8LIST___IXV
  65.    %LINK-I-UDFSYM,         REMOVEFROMBACK__8LIST___FXNF
  66.    %LINK-I-UDFSYM,         REMOVEFROMBACK__8LIST___IXNI
  67.    %LINK-I-UDFSYM,         REMOVEFROMFRONT__8LIST___FXNF
  68.    %LINK-I-UDFSYM,         REMOVEFROMFRONT__8LIST___IXNI
  69.    %LINK-I-UDFSYM,         __CT__8LIST___FXV
  70.    %LINK-I-UDFSYM,         __CT__8LIST___IXV
  71.    %LINK-I-UDFSYM,         __DT__8LIST___FXV
  72.    %LINK-I-UDFSYM,         __DT__8LIST___IXV
  73.  
  74. I don't have access to any books or manuals besides the Deitel book.  Any
  75. help would be appreciated.
  76.  
  77. Thanks,
  78. Brian Gastineau
  79.